package t7;

import java.io.*;

public class demo1 {
    public static void main(String[] args) {
        OutputStream out =null;
        InputStream in = null;
        try {
            in = new FileInputStream("E:\\编程\\项目1\\作业\\src\\t7\\demo1.java");
            out = new FileOutputStream("E:\\code\\demo1.java");
            int length;
            byte[] b = new byte[500];
            while ((length = in.read(b))!=-1) {
                String s = new String(b,0,length);
                System.out.println(s);
                out.write(b,0,length);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
